package cc.vv.btpartyjob.homepage.server

import cc.vv.baselibrary.http.BaseHttpRequest
import cc.vv.btpartyjob.homepage.moudel.req.*
import cc.vv.btpartyjob.homepage.moudel.resp.*
import com.dawning.utiming.task.api.HomeworkAPI

/**
 * 请求服务器Server
 * Created by Chen.qi on 2018/10/24.
 */
object HomeHttpServer {

    /** 退出登录*/
    fun exitLogin(isShow: Boolean = false) {
        val map: LinkedHashMap<String, Object> = LinkedHashMap()
        val path = HomeworkAPI.exitLogin
        BaseHttpRequest.postRequest(path, map, ExitLoginResponseObj::class.java, isShow)
    }

    /**
     * 预警通知
     */
    fun warningNoticList(page: Int?, pageSize: Int?, type: String?, isShow: Boolean = false) {
        val request = WarningNoticeRequestObj()
        request.page = "$page"
        request.size = "$pageSize"
        request.type = type
        val path = HomeworkAPI.warningNoticeListUrl + "/$page/$pageSize"
        BaseHttpRequest.postRequest(path, request, MineProjectWarningResponseObj::class.java, isShow)
    }

    /**
     * 我的志愿项目
     */
    fun mineVolunteerProjectList(isShow: Boolean = false) {
        val request = MineVolunteerProjectRequestObj()
        val path = HomeworkAPI.mineZhiYuanProjectListUrl
        BaseHttpRequest.postRequest(path, request, MineVolunteerProjectResponseObj::class.java, isShow)
    }

    /**
     * 获取党员承诺最新数据
     */
    fun getPartyChengNuoData(isShow: Boolean = false) {
        val request = MineVolunteerProjectRequestObj()
        val path = HomeworkAPI.getHotChengNuoDataUrl
        BaseHttpRequest.getRequest(path, request, PartyChengNuoResponseObj::class.java, isShow)
    }

    /**
     * 代办公文
     */
    fun daiBanGongWen(page: Int?, pageSize: Int?, isShow: Boolean = false) {
        val request = DaiBanGongWenRequestObj()
        request.page = "$page"
        request.pageSize = "$pageSize"
        val path = HomeworkAPI.daiBanGongWenUrl
        BaseHttpRequest.getRequest(path, request, DaiBanGongWenResponseObj::class.java, isShow)
    }

    /**
     * 通知公告
     */
    fun noticeHttp(page: Int?, pageSize: Int?, isShow: Boolean = false) {
        val request = NoticeRequestObj()
        request.page = "$page"
        request.pageSize = "$pageSize"
        request.type = "2"
        val path = HomeworkAPI.noticeUrl
        BaseHttpRequest.getRequest(path, request, NoticeResponseObj::class.java, isShow)
    }

    /**
     * 通知公告详情
     */
    fun noticeDetailHttp(id: String?, isShow: Boolean = false) {
        val request = NoticeDetailRequestObj()
        request.id = id
        BaseHttpRequest.getRequest(HomeworkAPI.noticeDetailUrl, request, NoticeDetailResponseObj::class.java, isShow)
    }

    /**
     * 代办公文详情
     */
    fun daiBanGongWenDetail(id: String?, isShow: Boolean = false) {
        val request = DaiBanDetailRequestObj()
        request.id = id
        BaseHttpRequest.getRequest(HomeworkAPI.daiBanGongWenDetailUrl, request, DaiBanDetailResponseObj::class.java, isShow)
    }

}